<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../../css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/html/js/getParameter.js"></script>
    <script type="text/javascript" src="/html/js/jquery.js"></script>
    <script type="text/javascript" src="../../js/api.js"></script>
    <script type="text/javascript" src="../../js/axios.js"></script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>仓库管理</li>
    <li>仓库管理</li>
    <li>添加仓库</li>
  </ul>
</div>
<div class="formbody">
  <div class="formtitle"><span>仓库信息</span></div>
    <form action="" id="fom2">
  <ul class="forminfo">
    <li>
      <label>仓库名称</label>
      <input name="cName" type="text" class="dfinput" />
      <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>仓库地址</label>
      <input name="cAddress" type="text" class="dfinput" />
      <i>必填，不能超过300个字符</i>
    </li>
    <li>
      <label>所属区域</label>
      <select class="dfselect" name="provinceId" id="c3">
          <option>请选择</option>
          <option>北京</option>
          <option>江苏</option>
          <option>天津</option>
      </select>
      省
      <select class="dfselect" name="cityId" id="c4">
          <option>请选择</option>
          <option>北京</option>
          <option>南京</option>
          <option>天津</option>
      </select>
      市
      <i>必选</i>
    </li>
    <li>
      <label>负责人</label>
      <select class="dfselect" name="userId" id="c5">
          <option>请选择</option>
          <option>周仓</option>
          <option>廖化</option>
          <option>张昭</option>
      </select>
       <i>只能是财务部仓库管理员职位</i>
    </li>
    <li>
      <label>联系方式</label>
      <input name="phone" type="text" class="dfinput" />
       <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>描述</label>
      <textarea class="textinput" name="details"></textarea>
      <i>可选</i>
    </li>
    <li>
      <label>状态</label>
      <select class="dfselect" name="state">
          <option value="1">可用</option>
          <option value="0">不可用</option>
        </select>
      <i>必选</i>
    </li>
    <li>
      <label>创建人</label>
      <input name="usersId" type="text" value="马云" readonly="readonly" class="roinput" id="c9"/>
      <i>不能编辑</i>
    </li>
    <li>
      <label>创建时间</label>
      <input name="creationTime" type="text" value="2017-11-18 15:36:10" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>&nbsp;</label>
      <input name="" type="button" class="btn" value="确定" id="sure2"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="button" class="btn" value="返回" onclick="window.location.href='storageList.html'"/>
    </li>
  </ul>
    </form>
</div>
</body>
</html>
<script type="text/javascript">
    $(function () {
        queryUsers()
        addressMenuInitOfDefault($("#c3"), $("#c4"), null,null)
        $("#c9").val(1);
        $("#sure2").click(function () {
            var r = confirm("是否添加数据");
            if (r){
                var dataArr = $("#fom2").serialize()
                axiosRequest("post", "/warehouse/addWare",dataArr)
                    .then((res) => {
                        alert("增添成功")
                        window.location.href = "./storageList.html"
                    })
            }
        });
    });
    function queryUsers() {
        var dataArr = "deptId="+3+"&jobId="+8
        axiosRequest("post", "/warehouse/queryUsers",dataArr)
            .then((res) => {
                var lis = "<option value=\""+0+"\">请选择</option>"
                for (var i = 0; i < res.data.length; i++) {
                    var li = "<option value=\""+res.data[i].uId+"\">"+res.data[i].uName+"</option>"
                    lis+=li;
                }
                $("#c5").html(lis);
            })
    }
</script>
